/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bean;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Ovidio Alonso Zapata
 */
@Entity
@Table(name = "test")
@NamedQueries({@NamedQuery(name = "Test.findByNumeroTest", query = "SELECT t FROM Test t WHERE t.testPK.numeroTest = :numeroTest"), @NamedQuery(name = "Test.findByDescripcion", query = "SELECT t FROM Test t WHERE t.descripcion = :descripcion"), @NamedQuery(name = "Test.findByClasificacion", query = "SELECT t FROM Test t WHERE t.testPK.clasificacion = :clasificacion")})
public class Test implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TestPK testPK;
    @Column(name = "descripcion", nullable = false)
    private String descripcion;

    public Test() {
    }

    public Test(TestPK testPK) {
        this.testPK = testPK;
    }

    public Test(TestPK testPK, String descripcion) {
        this.testPK = testPK;
        this.descripcion = descripcion;
    }

    public Test(BigInteger numeroTest, String clasificacion) {
        this.testPK = new TestPK(numeroTest, clasificacion);
    }

    public TestPK getTestPK() {
        return testPK;
    }

    public void setTestPK(TestPK testPK) {
        this.testPK = testPK;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (testPK != null ? testPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Test)) {
            return false;
        }
        Test other = (Test) object;
        if ((this.testPK == null && other.testPK != null) || (this.testPK != null && !this.testPK.equals(other.testPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bean.Test[testPK=" + testPK + "]";
    }

}
